##此代码为ESP8266飞控驱动代码

import machine,time
from machine import Pin, I2C, ADC, PWM,UART


print("FW_C start")
uart=UART(1, baudrate=9600)
uart.write("FW_C start")
#开机后与任务板通信
NL=Pin(5, Pin.OUT)
NL.value(1)
#机翼灯光
ACL=PWM(Pin(4))
ACL.freq(500)
ACL.duty(5)
#机腹频闪灯
way=PWM(Pin(13))
way.freq(50)
for i in range(0,1024,10):
    way.duty(i)
    time.sleep(0.1)
way.duty(0)
#舵机控制
power=PWM(Pin(12))
power.freq(1000)
power.duty(100)
#涵道电机初始化
def power_control(power):
    power.duty(power)
#涵道电机控制函数


i2c = I2C(scl=Pin(9), sda=Pin(10), freq=100000)

def NL(NL_type):
    if NL_type=='ON':
        NL.value(1)
        print("NL ON")
        return 'NL ON'
    if NL_type=='OFF':
        NL.value(0)
        print("NL OFF")
        return 'NL OFF'
#机翼灯光控制函数


